import { Modal as AntdModal } from 'antd';
import OriginModal from './Modal';

import {
  ModalStaticFunctions,
  modalGlobalConfig,
} from 'antd/lib/modal/confirm';
export type { Props as ModalProps } from './Modal';

export type ModalType = typeof OriginModal &
  ModalStaticFunctions & {
    useModal: typeof AntdModal.useModal;
    destroyAll: () => void;
    config: typeof modalGlobalConfig;
  };

const Modal = OriginModal as ModalType;
const {
  useModal,
  info,
  success,
  error,
  warning,
  warn,
  confirm,
  config,
  destroyAll,
} = AntdModal;

Modal.useModal = useModal;
Modal.info = info;
Modal.success = success;
Modal.error = error;
Modal.warning = warning;
Modal.warn = warn;
Modal.confirm = confirm;
Modal.destroyAll = destroyAll;
Modal.config = config;

export default Modal;
